package edu.nf.takeoutdemo.model.converter;

import edu.nf.takeoutdemo.model.dto.DishDTO;
import edu.nf.takeoutdemo.model.entity.Dish;
import edu.nf.takeoutdemo.model.vo.DishVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 *
 * @author zjl
 * @date 2025/10/27
 */
@Mapper(componentModel = "spring")
public interface DishConverter {

    @Mappings({
            @Mapping(source = "id",target = "id"),
            @Mapping(source = "name",target = "name"),
            @Mapping(source = "categoryId",target = "categoryId"),
            @Mapping(source = "price",target = "price"),
            @Mapping(source = "image",target = "image"),
            @Mapping(source = "description",target = "description"),
            @Mapping(source = "status",target = "status"),
    })
    Dish toDish(DishDTO dishDTO);

    @Mappings({
            @Mapping(source = "id",target = "id"),
            @Mapping(source = "name",target = "name"),
            @Mapping(source = "categoryId",target = "categoryId"),
            @Mapping(source = "price",target = "price"),
            @Mapping(source = "image",target = "image"),
            @Mapping(source = "description",target = "description"),
            @Mapping(source = "status",target = "status"),
            @Mapping(source = "updateTime",target = "updateTime"),
    })
    DishVO toDishVO(Dish dish);
}
